package service

import (
	"time"
	"yun_image/config/image"
	"yun_image/dao"
	"yun_image/entity"
)

// SaveCategory 创建分类
func SaveCategory(category *entity.Category) error {
	category.CreateTime = time.Now().UnixMilli()
	category.IsDeleted = image.NotDeleted
	err := dao.CreateCategory(category)
	return err
}

// GetCategoriesByAccount 获取用户的分类
func GetCategoriesByAccount(categories *[]entity.Category, account string) error {
	err := dao.GetCategoriesByAccount(categories, account)
	return err
}

// RemoveCategory 删除分类
func RemoveCategory(id int, account string) error {
	err := dao.DeleteCategory(id, account)
	return err
}
